home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2002 November / SGI Freeware 2002 November - Disc 3.iso / dist / fw_qt3.idb / usr / freeware / Qt / doc / html / richedit-main.png < prev    next >
Portable Network Graphic  |  2002-04-08  |  21KB  |  739x383  |  16-bit (404 colors)
Labels: text | electronics | screenshot | display | software | number | computer icon | font | web page | operating system
OCR: Rich Edit × File Edit Format Help BIU Helvetica 13 In Qt we have an alternative to the callback technique. We can use signals and slots. A signal is a function which is called when a particular event occurs. Qt's widgets have many pre-defined signals, but we can always subclass to add our own. A slot is a function that is called when a signal occurs. Qt's widgets have many pre-defined slots, but it is common practice to add your own slots so that you can handle events that you are interested in. The signals and slots mechanism is type safe: the signature of a signal must match the signature of the receiving slot. (In fact a slot may have a shorter signature than the signal it receives because it can ignore extra arguments. ) Since the signatures match, the compiler can help us detect type mismatches. Signals and slots are loosely coupled: a class which emits a signal neither knows nor cares which slots receive the signal. Qt's signals and slots mechanism ensures that if you connect a signal to a slot that the slot will be called with the signal's parameters at the right time. Signals and slots can take any number of arguments of any type. They are completely typesafe: no more callback core dumps! MMMM